package model;

import java.util.Arrays;
import java.util.Date;

public class ParsedPage {
	
	private ParsedProduct parsedProduct;
	private String[] links;
	private Date visitDate;
	private String pageURL;
	private String meta;
	
	public ParsedProduct getParsedProduct() {
		return parsedProduct;
	}
	
	public void setParsedProduct(ParsedProduct parsedProduct) {
		this.parsedProduct = parsedProduct;
	}
	
	public String[] getLinks() {
		return links;
	}
	
	public void setLinks(String[] links) {
		this.links = links;
	}
	
	public Date getVisitDate() {
		return visitDate;
	}
	
	public void setVisitDate(Date visitDate) {
		this.visitDate = visitDate;
	}
	
	public String getPageURL() {
		return pageURL;
	}
	
	public void setPageURL(String pageURL) {
		this.pageURL = pageURL;
	}

	public String getMeta() {
		return meta;
	}

	public void setMeta(String meta) {
		this.meta = meta;
	}

	public ParsedPage(ParsedProduct parsedProduct, String[] links,
			Date visitDate, String pageURL, String meta) {
		this.parsedProduct = parsedProduct;
		this.links = links;
		this.visitDate = visitDate;
		this.pageURL = pageURL;
		this.meta = meta;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + Arrays.hashCode(links);
		result = prime * result + ((meta == null) ? 0 : meta.hashCode());
		result = prime * result + ((pageURL == null) ? 0 : pageURL.hashCode());
		result = prime * result
				+ ((parsedProduct == null) ? 0 : parsedProduct.hashCode());
		result = prime * result
				+ ((visitDate == null) ? 0 : visitDate.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ParsedPage other = (ParsedPage) obj;
		if (!Arrays.equals(links, other.links))
			return false;
		if (meta == null) {
			if (other.meta != null)
				return false;
		} else if (!meta.equals(other.meta))
			return false;
		if (pageURL == null) {
			if (other.pageURL != null)
				return false;
		} else if (!pageURL.equals(other.pageURL))
			return false;
		if (parsedProduct == null) {
			if (other.parsedProduct != null)
				return false;
		} else if (!parsedProduct.equals(other.parsedProduct))
			return false;
		if (visitDate == null) {
			if (other.visitDate != null)
				return false;
		} else if (!visitDate.equals(other.visitDate))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "ParsedPage [parsedProduct=" + parsedProduct + ", links="
				+ Arrays.toString(links) + ", visitDate=" + visitDate
				+ ", pageURL=" + pageURL + ", meta=" + meta + "]";
	}	
}
